<template>
	<view >
		<mescroll-uni ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :up="upOption" :top="230">
			<view v-for="(item,index) in list" :key="index" >
				<listItem :item="item" @boxClick="routo"/>				
			</view>			
		</mescroll-uni>
	</view>
</template>

<script>
	import {getFormList,makeAnAppointment} from '../../../api/message.js';
	import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
	import listItem from './listItem.vue'
	export default {
		name:"Order",
		mixins: [MescrollMixin], // 使用mixin
		components:{
			listItem
			// Scroll
		},		
		data() {
			return {
				list:[],
				upOption:{
					auto:false
				}
			};
		},
		methods:{
			routo(v){
				console.log(v)
				const params = {
					reserveOrderId:v.reserveOrderId
				}
				this.$navTo.togo('/pages/views/bookingManagement/bookingdetail',params)
			},
			downCallback(){
				this.list = [] 
				this.mescroll.resetUpScroll( true )								
			},
			async upCallback(page){
				let pageObj = {
					pageIndex:page.num,
					pageSize:page.size
				}				
				let res = await makeAnAppointment(pageObj)
				if(res.result === '1'){
					this.mescroll.endSuccess(res.rows.length)
					this.list = [...this.list,...res.rows]
				} else {
					this.mescroll.endErr()
				}			
			}
		}
	}
</script>

<style lang="scss" scoped>

</style>
